package com.cd.service.product.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cd.bean.Product;
import com.cd.dao.ProductMapper;
import com.cd.service.product.ProductService;

@Service("productService")
public class ProductServiceImpl implements ProductService{

	@Autowired
	ProductMapper productMapper;
	@Override
	public void save(Product product) throws Exception {
	
		productMapper.save(product);
	}

	@Override
	public void delete(Integer id) throws Exception {
		productMapper.delete(id);
	}

	@Override
	public void edit(Product product) throws Exception {
		productMapper.update(product);
		
	}

	@Override
	public List<Product> listAll() throws Exception {
		
		return productMapper.queryByList();
	}

	@Override
	public Product findById(Integer id) throws Exception {
		
		return productMapper.query(id);
	}

	@Override
	public void deleteAll() throws Exception {
		
		
	}

	@Override
	public Integer size() throws Exception {
		return productMapper.getCount();
	}

	@Override
	public List<Product> listLimit() throws Exception {
		return productMapper.list();
	}

}
